<template>
  <div class="login_container">
    <div class="login_area">
      <div class="login_title">会议名单注册</div>
      <div class="login_info">
        <van-form @submit="onSubmit" :show-error-message="false">
          <van-field
            v-model="username"
            name="请输入会议编码"
            placeholder="请输入会议编码"
            :rules="[{ required: true, message: '请输入会议编码' }]"
          />
          <van-field
            type="password"
            v-model="password"
            name="请输入会议密码"
            placeholder="请输入会议密码"
            :rules="[{ required: true, message: '请输入会议密码' }]"
          />
          <div style="margin: 16px; text-align: center;">
            <van-button class="submit_btn" icon="arrow" native-type="submit">
            </van-button>
          </div>
        </van-form>
      </div>
    </div>
  </div>
</template>

<script>
import apilist from "../utils/apiList";
export default {
  data() {
    return {
      username: "",
      password: "",
    };
  },
  created(){
    sessionStorage.clear()
  },
  methods: {
    onSubmit() {
      console.log("登录");
      this.login();
    },
    async login() {
      let acc0 = this.$route.query.AccountName||this.$route.query.accountname;
      const res = await this.$axios.get(
        apilist[0] +
          "/LoginEvent?username=" +
          this.username +
          "&passwd=" +
          this.password
      );
      if (typeof res.data == "string") {
       this.$notify({
          type: "danger",
          message: res.data,
        });
      } else {
        sessionStorage.setItem("login", JSON.stringify(res.data));
        sessionStorage.setItem("query", JSON.stringify({ id: res.data.IDNo }));
        sessionStorage.setItem("join", 1);
        
        
        this.$router.push({
          path: "/navigatorIndex",
          query: { id: res.data.IDNo,accountname:acc0 },
        });
      }
    },
  },
};
</script>

<style scoped lang="less">
.login_container {
  position: relative;
  height: 100%;
  background: url(../assets/images/login.jpg) no-repeat;
  background-size: auto 100%;
  @media (min-width: 768px) {
    background-size: 100% 100%;
  }
  .login_area {
    box-sizing: border-box;
    padding: 15px;
    position: absolute;
    bottom: 0;
    width: 100%;
    color: #fff;
    .login_title {
      padding: 15px 30px;
      font-size: 26px;
      font-weight: 500;
      color: #ffffff;
      line-height: 31px;
    }
    .login_info {
      height: 240px;
      padding: 20px;
      box-sizing: border-box;
      border-radius: 25px;
      background: rgba(0, 0, 0, 0.35);

      // background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #000000 100%);
      /deep/ .van-cell {
        background-color: transparent;
        .van-field__body {
          color: #fff;
          .van-field__control {
            color: #fff !important;
          }
          input {
            height: 40px;
          }
        }
      }

      .submit_btn {
        margin: 0 auto;
        border: none;
        font-size: 30px;
        border-radius: 50%;
        width: 60px;
        height: 60px;
        line-height: 66px;
        color: #fff;
        background: linear-gradient(137deg, #3ca9e5 0%, #124890 100%);
      }
    }
  }
}
</style>